/*
 * MIT License
 *
 * Copyright (c) 2020 wen.gu <454727014@qq.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/***************************************************************************
 * Name: data_type_generator.h
 *
 * Purpose: data type generator implementation
 *
 * Developer:
 *   wen.gu , 2021-05-10
 *
 * TODO:
 *
 ***************************************************************************/

/******************************************************************************
 **    INCLUDES
 ******************************************************************************/
#ifndef __DATA_TYPE_GENERATOR_H__
#define __DATA_TYPE_GENERATOR_H__

#include <string>
#include "typedef_content.h"
/******************************************************************************
 **    MACROS
 ******************************************************************************/
/** for base type define in c++ language */
#define BASE_TYPE_BOOL   "bool"
#define BASE_TYPE_INT8   "int8_t"
#define BASE_TYPE_INT16  "int16_t"
#define BASE_TYPE_INT32  "int32_t"
#define BASE_TYPE_INT64  "int64_t"
#define BASE_TYPE_UINT8  "uint8_t"
#define BASE_TYPE_UINT16 "uint16_t"
#define BASE_TYPE_UINT32 "uint32_t"
#define BASE_TYPE_UINT64 "uint64_t"
#define BASE_TYPE_FLOAT  "float"
#define BASE_TYPE_DOUBLE "double"
#define BASE_TYPE_STRING "std::string"
#define BASE_TYPE_STRUCT  "struct"
#define BASE_TYPE_VECTOR  "std::vector"
#define BASE_TYPE_ENUM    "enum class"  /**todo, aways use Strong type define for enum?? refine me?? */
#define BASE_TYPE_MAP     "std::map"

/******************************************************************************
 **    TYPE DEFINITIONS
 ******************************************************************************/



/******************************************************************************
 **    CLASSES/FUNCTIONS DEFINITIONS
 ******************************************************************************/
class DataTypeGenerator final
{
public:
    DataTypeGenerator(const std::string& template_str);
    ~DataTypeGenerator();

public:
    bool generate(const DataTypeArray& dta, std::string& out_file);

private:
    std::string template_str_;
};

#endif /** !__DATA_TYPE_GENERATOR_H__ */

